home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Misc / Crossword / Source / Notifier.m < prev    next >
Text File  |  1992-10-11  |  1KB  |  61 lines

  1. /*
  2.  
  3. File Notifier.m
  4.  
  5. A notifier alerts other objects when its status either changes or will change.  An object typically responds to the notification message by updating information that depends on the notifying object.
  6.  
  7. Objects that register for notification must respond to the update:message: method.  The first argument to this method is the object sending the notification.  The second is an integer that identifies the message.
  8.  
  9. */
  10.  
  11. #import <appkit/appkit.h>
  12.  
  13. #import "Notifier.h"
  14.  
  15.  
  16. /* ————————————————————————————————————————————————————————————————————————————  */
  17.  
  18.  
  19. @implementation Notifier
  20.  
  21.  
  22. - init
  23. {
  24.     [super  init];
  25.     receivers = [[List  alloc]  init];
  26.     
  27.     return self;
  28. }
  29.  
  30.  
  31. - free
  32. {
  33.     [receivers  free];
  34.     [super  free];
  35.     
  36.     return self;
  37. }
  38.  
  39.  
  40. - signup: (id) object
  41. {
  42.     [receivers  addObject: object];
  43.     return self;
  44. }
  45.  
  46.  
  47. - unsignup: (id) object
  48. {
  49.     [receivers  removeObject: object];
  50.     return self;
  51. }
  52.  
  53.  
  54. - notify: (int) message
  55. {
  56.     [receivers  makeObjectsPerform: @selector(update:message:) with: (id) message];
  57.     return self;
  58. }
  59.  
  60.  
  61. @end